﻿using System;
using log4net;

namespace Swirebev.PhotoDownload.Common
{
    public class Log
    {
		/// <summary>
		/// 记录错误日志
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="message"></param>
		/// <param name="ex"></param>
		public static void Error(Type declaringType, string message, Exception ex)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Error(message, ex);
		}
		/// <summary>
		/// 记录比较严重的日志
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="message"></param>
		/// <param name="ex"></param>
		public static void Fatal(Type declaringType, string message, Exception ex)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Fatal(message, ex);
		}
		/// <summary>
		/// 记录一般信息
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="title"></param>
		/// <param name="message"></param>
		public static void Info(Type declaringType, String message)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Info(message);
		}
		/// <summary>
		/// 记录调试信息
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="message"></param>
		public static void Debug(Type declaringType, String message)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Debug(message);
		}
		/// <summary>
		/// 记录警告信息
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="message"></param>
		public static void Warn(Type declaringType, String message)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Warn(message);
		}
		/// <summary>
		/// 记录警告信息
		/// </summary>
		/// <param name="declaringType"></param>
		/// <param name="message"></param>
		/// <param name="ex"></param>
		public static void Warn(Type declaringType, String message, Exception ex)
		{
			ILog log = log4net.LogManager.GetLogger(declaringType);
			log.Warn(message, ex);
		}
    }
}
